package com.tesis_2.Utils;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;

import com.example.t2_clientback.R;
import com.tesis_2.MO.MOReserva;

public class UTReservaSimpleAdapter extends  ArrayAdapter<MOReserva> {
	
	private final Context context;
	private final ArrayList<MOReserva> values;
	
	public UTReservaSimpleAdapter(Context context, ArrayList<MOReserva> objects) {
		super(context, R.layout.activity_uiaceptar_reserva, objects);
		this.context = context;
		this.values = objects;
		// TODO Auto-generated constructor stub
	}
	
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context
			.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
		View rowView = inflater.inflate(R.layout.activity_uiaceptar_reserva, parent, false);
		
		((TextView) rowView.findViewById(R.id.txvRestName_aceptar_reserva)).setText( ((MOReserva) getItem(position)).getRestaurant_name());
		((TextView) rowView.findViewById(R.id.txvLocalName_aceptar_reserva)).setText( ((MOReserva) getItem(position)).getLocal_name());
		((TextView) rowView.findViewById(R.id.txvHora_aceptar_reserva)).setText(((MOReserva) getItem(position)).getFormatedRTime());
		((TextView) rowView.findViewById(R.id.txvFecha_aceptar_reserva)).setText(((MOReserva) getItem(position)).getFormatedRDate());
		((TextView) rowView.findViewById(R.id.txvUsuario_aceptar_reserva)).setText(((MOReserva) getItem(position)).getUser());	
		
		return rowView;
	}
	

}
